<template>
  <div>
    <div class="xq_echarts">
      <!-- 详情数据里面的图表 -->
      <div id="info_myChart"></div>
      <!-- 详情数据里面的图表2 -->
      <div id="info_myChart2"></div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  methods: {
    info_myChart() {
      //详细数据里面的图表
      let info_myChart = this.$echarts.init(
        document.getElementById("info_myChart")
      );

      info_myChart.setOption({
        title: {
          text: "温湿度"
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow"
          }
        },
        legend: {
          show: true,
          data: [
            {
              name: "一次供温",
              icon: "circle"
            },
            {
              name: "一次回温",
              icon: "circle"
            },
            {
              name: "二次供温",
              icon: "circle"
            },
            {
              name: "二次回温",
              icon: "circle"
            }
          ],
          bottom: 0,
          left: "left"
        },
        grid: {
          left: 40
        },
        toolbox: {
          show: true
        },
        xAxis: {
          type: "value"
        },
        yAxis: {
          type: "category",
          inverse: true,
          data: ["00:00", "03:00", "04:00"]
        },
        series: [
          {
            name: "一次供温",
            type: "bar",
            data: [165, 170, 30],
            barWidth: 5,
            itemStyle: {
              normal: { areaStyle: { type: "default" }, color: "#70c0b3" }
            }
          },
          {
            name: "一次回温",
            type: "bar",
            barWidth: 5,
            data: [150, 105, 110],
            itemStyle: {
              normal: { areaStyle: { type: "default" }, color: "#00a8ff" }
            }
          },
          {
            name: "二次供温",
            type: "bar",
            barWidth: 5,
            data: [220, 82, 63],
            itemStyle: {
              normal: { areaStyle: { type: "default" }, color: "#ea547a" }
            }
          },
          {
            name: "二次回温",
            type: "bar",
            barWidth: 5,
            data: [220, 82, 63],
            itemStyle: {
              normal: { areaStyle: { type: "default" }, color: "#d6fb0a" }
            }
          }
        ]
      });
    },
    info_myChart2() {
      //详细数据里面的图表2
      let info_myChart = this.$echarts.init(
        document.getElementById("info_myChart2")
      );
      info_myChart.setOption({
        title: {
          text: " 水泵频率"
        },
        tooltip: {
          trigger: "axis"
        },
        grid: {
          left: 30
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: [
            "00:00",
            "03:00",
            "06:00",
            "09:000",
            "12:00",
            "15:00",
            "18:00",
            "21:00",
            "24:00"
          ]
        },
        yAxis: {
          type: "value"
        },
        series: [
          {
            name: "水泵频率",
            type: "line",
            data: [50, 120, 220, 250, 230, 220, 180, 180, 190],
            markPoint: {
              data: [
                { type: "max", name: "最大值" },
                { type: "min", name: "最小值" }
              ]
            },
            itemStyle: { color: "#00a8ff" }
          }
        ]
      });
    }
  },
  mounted() {
    this.info_myChart();
    this.info_myChart2();
  }
};
</script>
<style lang="scss" scoped>
// 详情数据-图表样式
.xq_echarts {
  overflow: auto;
  #info_myChart {
    width: 340px;
    height: 300px;
  }
  #info_myChart2 {
    margin-top: 0.2rem;
    width: 340px;
    height: 300px;
  }
}
</style>